<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>XXX管理系统</title>
  <link rel="stylesheet" href="assets/css/bootstrap.css">
  <link rel="stylesheet" href="assets/css/style.css">
</head>
<body>
  <?php require_once '_nav.php';?>
  <main class="container">
    <h1 class="heading">用户管理 <a class="btn btn-link btn-sm" href="add.php">添加</a></h1>
    <table class="table table-hover">
      <thead>
        <tr>
          <th>#</th>
          <th>头像</th>
          <th>姓名</th>
          <th>性别</th>
          <th>年龄</th>
          <th class="text-center" width="140">操作</th>
        </tr>
      </thead>
      <tbody>
        <?php if(is_array($res)):?>
        <?php foreach($res as $item): ?>
        <tr>
            <th scope="row"><?php echo $item['id']; ?></th>
            <td><img src="<?php echo $item['photo']; ?>" class="rounded" alt="张三"></td>
            <td><?php echo $item['name']; ?></td>
            <td><?php echo $item['gender'];?></td>
            <td><?php echo $item['age'];?>
            <?php //echo $item['birthday'];?></td>
            <td class="text-center">
              <a href="edit.php?id=<?php echo $item['id'];?>" class="btn btn-info btn-sm">编辑</a>
              <a href="del.php?id=<?php echo $item['id'];?>" class="btn btn-danger btn-sm">删除</a>
            </td>
          </tr>
        <?php endforeach;?>
        <?php else:?>
        <tr>
          <td colspan='6'><?php echo '暂无数据';?></td>
        </tr>
        <?php endif;?>
      </tbody>
    </table>
  </main>
</body>
</html>
